/// @description Insert description here
// You can write your code in this editor
var base_dist = point_distance(x,y,x_base,y_base);
if (instance_exists(o_Enemy)){
	var enem = instance_nearest(x,y,o_Enemy);
if (point_distance(x,y,o_Hero.x,o_Hero.y)<125 && start == 0)
{
		direction = point_direction(x,y,enem.x,enem.y)
	speed = 10;
	start = 1;
}
}
if (dest == 1 ){
	direction = point_direction(x,y,x_base,y_base)
	speed = 10;
	if (base_dist <=10 ){instance_destroy();}
} 


if (point_distance(x,y,x_base,y_base)>140)
{

	dest = 1;
}
;
 if position_meeting(x, y, o_Enemy)
    {
          if (enem.hp > 0){
		enem.hp -= damage+1*o_Hero.fw_level; //уменьшаем здоровье врага на значение урона
		}
    }


